document.addEventListener('DOMContentLoaded', function() {
    const emojiWrapper = document.querySelector('.emoji-wrapper');
    emojiWrapper.addEventListener('click', function() {
        location.reload(); // 刷新页面
    });
});


document.getElementById("submitBtn").addEventListener("click", function (event) {
    event.preventDefault(); // 阻止按钮的默认跳转行为
    document.getElementById("myDropdown").classList.add("show"); // 显示下拉菜单
    // 在这里手动执行跳转操作
    window.location.href = 'https://www.baidu.com'; // 请替换为你实际想要跳转的URL
});

// 保持之前用于关闭下拉菜单的点击监听
window.onclick = function (event) {
    if (!event.target.matches('.dropbtn') && !event.target.closest('.dropdown-content')) {
        var dropdowns = document.getElementsByClassName("dropdown-content");
        for (var i = 0; i < dropdowns.length; i++) {
            var openDropdown = dropdowns[i];
            if (openDropdown.classList.contains('show')) {
                openDropdown.classList.remove('show');
            }
        }
    }
}

// 登录框和注册框的显示和隐藏
function showRegisterBox() {
    const loginBox = document.querySelector('.login-box');
    const registerBox = document.querySelector('.register-box');

    loginBox.style.display = 'none';
    registerBox.style.display = 'block';
}

function showLoginBox() {
    const loginBox = document.querySelector('.login-box');
    const registerBox = document.querySelector('.register-box');

    loginBox.style.display = 'block';
    registerBox.style.display = 'none';
}

function closeLoginOrRegisterBox() {
    const loginBox = document.querySelector('.login-box');
    const registerBox = document.querySelector('.register-box');

    if (loginBox.style.display === 'none') {
        registerBox.style.display = 'none';
    } else {
        loginBox.style.display = 'none';
    }
}


